<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="jx" tagdir="/WEB-INF/tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@page import="com.solution.common.config.PublicConfig"%>
<%@page import="com.solution.admin.home.constants.IndexConstants"%>
<%
	String basePath = PublicConfig.ROOT_PATH;
	String imgRootURL = PublicConfig.IMG_ROOT_URL;
%>
<c:set var="rootPath" value="<%=basePath%>"></c:set>
<c:set var="imgRootURL" value="<%=imgRootURL%>"></c:set>
<script type="text/javascript" src="<%=basePath%>/statics/plugins/layer/layer.js"></script>
<!---头部公共部分开始-->
<div class="header">
	<div class="wrap">
		<!---头部公共部分开始-->
		<div class="header">
			<div class="nav">
				<div class="nav_con">
					<div class="left">
						<p>欢迎来到景旭商城 &nbsp;&nbsp;<a href="${rootPath}/pc/index" style="color:#999;font-size:12px;">首页</a></p>
					</div>
					<div class="right">
						<ul id="nav">
							<shiro:guest>
								<li><a style="color: #999; text-decoration: none;" href="javascript:void(0)">您好，</a><a href="<%=basePath%>/home/loginPage">请登录</a></li>
								<li><a href="<%=basePath%>/reg/toRegPage" style="color: #dd2726">免费注册</a></li>
							</shiro:guest>
							<shiro:user>
								<li><a style="color: #999; text-decoration: none;" href="<%=basePath%>/pc/my">&nbsp;欢迎[<shiro:principal property="userName" />]，
								</a><a href="<%=basePath%>/pc/logout">退出</a></li>
							</shiro:user>
							<li class="hasdrop"><a href="${rootPath}/pc/order/list">我的订单</a>
							<li><a href="<%=basePath%>/pc/my">个人中心</a></li>
							<li><a href="<%=basePath%>/pc/my/favorite">收藏中心</a></li>
							<li id="sign_li"><a href="#" onclick="javascript: doSign();">签到领积分</a></li>
							<li><span style="color: #cccccc; padding: 7px 50px; display: inline-block"></span></li>
							<li><a href="javascript:void(0)" id="purchasingHotline"></a></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<!---头部公共部分结束-->
	</div>
</div>
<div class="member_header">
	<div class="member_header_con">
		<h1>
			<a href="<%=basePath%>/pc/index"><img src="<%=basePath%>/statics/images/logo5.png" /></a>
		</h1>
		<div class="member_nav">
			<ul>
				<%-- <li><a class="a1" href="<%=basePath%>/pc/index">首页</a></li>
				<li onmouseover="this.className='hover'" onMouseOut="this.className=''"><a href="<%=basePath%>/pc/my" class="a1">账户管理<i></i></a>
					<dl>
						<dd>
							<p>
								<span>账户管理</span><i></i>
							</p>
						</dd>
						<dt>
							<a href="<%=basePath%>/pc/my"><p>我的信息</p></a>
						</dt>
						<dt>
							<a href="<%=basePath%>/pc/my/mypwd"><p>修改密码</p></a>
						</dt>
						<dt>
							<a href="<%=basePath%>/pc/my/address"><p>收货地址</p></a>
						</dt>
					</dl></li> --%>
			</ul>
		</div>
		<div class="member_header_right">
			<div class="search_part11">
				<form action="<%=basePath%>/pc/product/search" method="post">
					<input type="text" name="searchKey" class="inputstyle11" placeholder="输入关键字搜索" /> <input type="submit" class="inputbtn11" value="搜索" />
				</form>
			</div>
			<div class="cart_part1">
				<p>
					<a href="<%=basePath%>/pc/shoppingcart/list"><i></i><span>我的购物车</span><em id="shopCount">0</em></a>
				</p>
			</div>
		</div>
	</div>
</div>
<!---头部公共部分结束-->
<script type="text/javascript">
	$(function() {
		//采购热线
		$.ajax({
			type : "post",
			url : "<%=basePath %>/dict/listKeyMapEntites?timesmap=" + new Date().getTime(),
			data: {keyType: 'purchasingHotline'},
			async : false,
			datatype : "json",
			success : function(json) {
				if (json.data.length > 0) {
					$('#purchasingHotline').html('采购热线：' + json.data[0].keyValue);
				}  
			}
		});
		/**
		 * 获取购物车数量
		 */
		$.ajax({
			type: 'POST',
			url: "<%=basePath %>/pc/shoppingcart/getShoppingcarCount",
			async: true,
			dataType: 'json',
			success: function(json) {
				if(json.code == '1') {
					$("#shopCount").html(json.data);
				}
			}
		});
		
		//当日是否允许签到
		$.ajax({
			type : "post",
			url :  rootPath + "/home/checkAllowSign",
			async : true,
			datatype : "json",
			success : function(json) {
				if (json.allowSign != 1) {
					$("#sign_li").remove();
				}
			}
		});
	});
	
	function doSign() {
		$.ajax({
			type : 'post',
			url : "<%=basePath%>/home/doSign",
			async : false,
			datatype : "json",
			success : function(json) {
				if (json.code == '1') {
					layer.msg(json.msg, {
						icon : 1
					});
				} else {
					layer.msg(json.msg, {
						time : 3000
					});
				}
			},
			error : function() {
				layer.msg('暂时无法签到', {
					time : 1000
				});
			}
		});
	}
</script>
